import request from '@/utils/request'
const base = request.route_api_path
export default {
  login: {
    auth: function(username, password) {
      return request({
        url: '/login',
        method: 'post',
        data: {
          username: username,
          password: password
        }
      })
    }
  },
  wserver: {
    getData: function(url) {
      return request({
        url: url,
        method: 'get',
        headers: {
          Accept: 'text/html,application/xhtml+xml,application/xml;charset=gb2312'
        }
      })
    }
  },
  sys: {
    logout: function() {
      return request({
        url: base + '/sys/' + 'logout',
        method: 'post'
      })
    },
    get_login_user: function() {
      return request({
        url: base + '/sys/' + 'login_user',
        method: 'get'
      })
    },
    get_account: function() {
      return request({
        url: base + '/sys/' + 'account',
        method: 'get'
      })
    },
    update_account: function(data) {
      return request({
        url: base + '/sys/' + 'account',
        method: 'put',
        data: data
      })
    },
    update_pass: function(data) {
      return request({
        url: base + '/sys/' + 'pass',
        method: 'put',
        data: data
      })
    }
  },
  rbac: {
    roles: function(data) {
      return request({
        url: base + '/rbac/roles/',
        method: 'get',
        params: data
      })
    },
    roles_for_user: function(user_id) {
      return request({
        url: base + 'rbac/users/' + user_id + '/roles/',
        method: 'get'
      })
    },
    reload: function() {
      return request({
        url: base + 'rbac/reload',
        method: 'get'
      })
    },
    add_role_for_user: function(user_id, role_id) {
      return request({
        url: base + 'rbac/users/' + user_id + '/roles/',
        method: 'post',
        data: { 'rid': role_id }
      })
    },
    del_role_for_user: function(user_id, role_id) {
      return request({
        url: base + 'rbac/users/' + user_id + '/roles/' + role_id,
        method: 'delete'
      })
    }
  },
  department: {
    all: function(data) {
      return request({
        url: base + '/departments/',
        method: 'get',
        params: data
      })
    },
    parents: function() {
      return request({
        url: base + '/departments/parents',
        method: 'get'
      })
    },
    tree: function() {
      return request({
        url: base + '/departments/tree',
        method: 'get'
      })
    },
    get: function(id) {
      return request({
        url: base + '/departments/' + id,
        method: 'get'
      })
    },
    add: function(data) {
      return request({
        url: base + '/departments/',
        method: 'post',
        data: data
      })
    },
    update: function(data) {
      return request({
        url: base + '/departments/' + data.id,
        method: 'put',
        data: data
      })
    },
    del: function(id) {
      return request({
        url: base + '/departments/' + id,
        method: 'delete'
      })
    }
  },
  rank: {
    all: function(query) {
      return request({
        url: base + '/ranks/',
        method: 'get',
        params: query
      })
    },
    get: function(id) {
      return request({
        url: base + '/ranks/' + id,
        method: 'get'
      })
    },
    getRankRoles: function(id) {
      return request({
        url: base + '/ranks/' + id + '/roles',
        method: 'get'
      })
    },
    add: function(data) {
      return request({
        url: base + '/ranks/',
        method: 'post',
        data: data
      })
    },
    update: function(data) {
      return request({
        url: base + '/ranks/' + data.id,
        method: 'put',
        data: data
      })
    },
    del: function(id) {
      return request({
        url: base + '/ranks/' + id,
        method: 'delete'
      })
    },
    get_roles_for_rank: function(id) {
      return request({
        url: base + '/ranks/' + id + '/roles/',
        method: 'get'
      })
    },
    add_role_to_rank: function(rank_id, role_id) {
      return request({
        url: base + '/ranks/' + rank_id + '/roles/' + role_id,
        method: 'post'
      })
    },
    add_role_area_to_rank: function(rank_id, data) {
      return request({
        url: base + '/ranks/' + rank_id + '/role/area/info',
        method: 'post',
        data: data
      })
    },
    del_role_from_rank: function(rank_id, role_id) {
      return request({
        url: base + '/ranks/' + rank_id + '/roles/' + role_id,
        method: 'delete'
      })
    }
  },
  user: {
    all: function(data) {
      return request({
        url: base + '/users/',
        method: 'get',
        params: data
      })
    },
    userlist: function(data) {
      return request({
        url: base + '/users/userlist',
        method: 'get',
        params: data
      })
    },
    get: function(uid) {
      return request({
        url: base + '/users/' + uid,
        method: 'get'
      })
    },
    add: function(data) {
      return request({
        url: base + '/users/',
        method: 'post',
        data: data
      })
    },
    update: function(data) {
      return request({
        url: base + '/users/' + data.uid,
        method: 'put',
        data: data
      })
    },
    updateOwnInfo: function(data) {
      return request({
        url: base + '/users/' + data.uid + '/own_info',
        method: 'put',
        data: data
      })
    },
    del: function(uid) {
      return request({
        url: base + '/users/' + uid,
        method: 'delete'
      })
    },
    ranks: function(id) {
      return request({
        url: base + '/users/' + id + '/ranks',
        method: 'get'
      })
    },
    add_rank_to_user: function(user_id, rank_id) {
      return request({
        url: base + '/users/' + user_id + '/ranks/' + rank_id,
        method: 'post'
      })
    },
    del_rank_from_user: function(user_id, rank_id) {
      return request({
        url: base + '/users/' + user_id + '/ranks/' + rank_id,
        method: 'delete'
      })
    }
  },
  company_contract: {
    all: function(company_id) {
      return request({
        url: base + '/company/' + company_id + '/contract/',
        method: 'get'
      })
    },
    attachment: function(company_id, contract_id) {
      return request({
        url: base + '/company/' + company_id + '/contract/' + contract_id + '/attachment',
        method: 'get'
      })
    },
    add: function(company_id, data) {
      return request({
        url: base + '/company/' + company_id + '/contract/',
        method: 'post',
        data: data
      })
    },
    update: function(company_id, data) {
      return request({
        url: base + '/company/' + company_id + '/contract/' + data.id,
        method: 'put',
        data: data
      })
    }
  },
  company_org: {
    get: function(company_id) {
      return request({
        url: base + '/company/' + company_id + '/org',
        method: 'get'
      })
    },
    newid: function(company_id) {
      return request({
        url: base + '/company/' + company_id + '/org/newid',
        method: 'get'
      })
    },
    update: function(company_id, data) {
      return request({
        url: base + '/company/' + company_id + '/org',
        method: 'put',
        data: data
      })
    }
  },
  contact_people: {
    all: function(company_id, data) {
      return request({
        url: base + '/company/' + company_id + '/contact_people/',
        method: 'get',
        params: data
      })
    },
    get: function(company_id, people_id) {
      return request({
        url: base + '/company/' + company_id + '/contact_people/' + people_id,
        method: 'get'
      })
    },
    add: function(company_id, data) {
      return request({
        url: base + '/company/' + company_id + '/contact_people/',
        method: 'post',
        data: data
      })
    },
    contact_records: function(data) {
      return request({
        url: base + '/company/' + data.company_id + '/contact_people/' + data.contact_people_id + '/contact_records/',
        method: 'get',
        params: data
      })
    },
    addContact: function name(company_id, people_id, data) {
      return request({
        url: base + '/company/' + company_id + '/contact_people/' + people_id + '/contact_record',
        method: 'post',
        data: { contact_record: data }
      })
    },
    update: function(company_id, data) {
      return request({
        url: base + '/company/' + company_id + '/contact_people/' + data.id,
        method: 'put',
        data: data
      })
    },
    del: function(company_id, people_id) {
      return request({
        url: base + '/company/' + company_id + '/contact_people/' + people_id,
        method: 'delete'
      })
    }
  },
  company: {
    all: function(data) {
      return request({
        url: base + '/company/',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/company/' + id,
        method: 'get'
      })
    },
    index: function(data) {
      return request({
        url: base + '/company/index',
        method: 'get',
        params: data
      })
    },
    indexById: function(id) {
      return request({
        url: base + '/company/index/' + id,
        method: 'get'
      })
    },
    clients: function() {
      return request({
        url: base + '/company/clients',
        method: 'get'
      })
    },
    business_roles: function(company_id) {
      return request({
        url: base + '/company/' + company_id + '/business_roles',
        method: 'get'
      })
    },
    comments: function(data) {
      return request({
        url: base + '/company/' + data.company_id + '/comments/',
        method: 'get',
        params: data
      })
    },
    candidates: function(data) {
      return request({
        url: base + '/company/' + data.company_id + '/candidates/',
        method: 'get',
        params: data
      })
    },
    add: function(data) {
      return request({
        url: base + '/company/',
        method: 'post',
        data: data
      })
    },
    add_comment: function(data) {
      return request({
        url: base + '/company/' + data.company_id + '/comment/',
        method: 'post',
        data: data
      })
    },
    updateBD: function(data) {
      return request({
        url: base + '/company/bd',
        method: 'put',
        data: data
      })
    },
    update: function(data) {
      return request({
        url: base + '/company/' + data.id,
        method: 'put',
        data: data
      })
    },
    del_comment: function(id, comment_id) {
      return request({
        url: base + '/company/' + id + '/comment/' + comment_id,
        method: 'delete'
      })
    },
    del_comments: function(id) {
      return request({
        url: base + '/company/' + id + '/comment/',
        method: 'delete'
      })
    },
    del: function(company_id) {
      return request({
        url: base + '/company/' + company_id,
        method: 'delete'
      })
    }
  },
  todo: {
    all: function(data) {
      return request({
        url: base + '/todo/',
        method: 'get',
        params: data
      })
    },
    is_handle: function(id) {
      return request({
        url: base + '/todo/' + id + '/is_handle',
        method: 'get'
      })
    }
  },
  bulletin: {
    all: function(data) {
      return request({
        url: base + '/bulletin/',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/bulletin/' + id,
        method: 'get'
      })
    },
    add: function(data) {
      return request({
        url: base + '/bulletin/',
        method: 'post',
        data: data
      })
    },
    update: function(data) {
      return request({
        url: base + '/bulletin/' + data.id,
        method: 'put',
        data: data
      })
    },
    delete: function(id) {
      return request({
        url: base + '/bulletin/' + id + '/delete',
        method: 'put'
      })
    }
  },
  report: {
    newest_dynamic_state: function(data) {
      return request({
        url: base + '/report/newest_dynamic_state',
        method: 'get',
        params: data
      })
    },
    own_cv_list_count: function(data) {
      return request({
        url: base + '/report/cv_list/own_count',
        method: 'get',
        params: data
      })
    },
    own_project_count: function(data) {
      return request({
        url: base + '/report/project/own_count',
        method: 'get',
        params: data
      })
    },
    own_cv_offer_count: function(data) {
      return request({
        url: base + '/report/cv_offer/own_count',
        method: 'get',
        params: data
      })
    },
    own_cash_back_amount: function(data) {
      return request({
        url: base + '/report/cash_back/own_amount',
        method: 'get',
        params: data
      })
    },
    cash_back: function(data) {
      return request({
        url: base + '/report/cash_back',
        method: 'get',
        params: data
      })
    },
    cv_list: function(data) {
      return request({
        url: base + '/report/cv_list',
        method: 'get',
        params: data
      })
    },
    cv_offer: function(data) {
      return request({
        url: base + '/report/cv_offer',
        method: 'get',
        params: data
      })
    },
    cv_on_boarding: function(data) {
      return request({
        url: base + '/report/cv_on_boarding',
        method: 'get',
        params: data
      })
    },
    new_client: function(data) {
      return request({
        url: base + '/report/new_client',
        method: 'get',
        params: data
      })
    }
  },
  invoice: {
    all: function(data) {
      return request({
        url: base + '/invoice/',
        method: 'get',
        params: data
      })
    },
    all_cash: function(data) {
      return request({
        url: base + '/invoice/cash/',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/invoice/' + id,
        method: 'get'
      })
    },
    applyData: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/apply',
        method: 'post',
        data: data
      })
    },
    check: function(id, status, data) {
      return request({
        url: base + '/invoice/' + id + '/check/' + status,
        method: 'post',
        data: data
      })
    },
    back: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/back',
        method: 'post',
        data: data
      })
    },
    bill: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/billing',
        method: 'post',
        data: data
      })
    },
    cancel: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/cancel',
        method: 'post',
        data: data
      })
    },
    back_to_check: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/back_to_check',
        method: 'post',
        data: data
      })
    },
    alloc: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/allocation',
        method: 'post',
        data: data
      })
    },
    refund: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/refund',
        method: 'post',
        data: data
      })
    },
    batch_handle_cash: function(id, data) {
      return request({
        url: base + '/invoice/' + id + '/cash/cash_ids',
        method: 'post',
        data: data
      })
    },
    handle_cash: function(id, cash_id) {
      return request({
        url: base + '/invoice/' + id + '/cash/' + cash_id,
        method: 'post'
      })
    }
  },
  notification: {
    message: function(data) {
      return request({
        url: base + '/notifications/message',
        method: 'get',
        params: data
      })
    },
    todo: function(data) {
      return request({
        url: base + '/notifications/todo',
        method: 'get',
        params: data
      })
    },
    read_messages: function(data) {
      return request({
        url: base + '/notifications/message/read',
        method: 'put',
        data: data
      })
    },
    read_all_messages: function() {
      return request({
        url: base + '/notifications/message/read/all',
        method: 'put'
      })
    }
  },
  project: {
    all: function(data) {
      return request({
        url: base + '/project/',
        method: 'get',
        params: data
      })
    },
    self: function(data) {
      return request({
        url: base + '/project/self',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/project/' + id,
        method: 'get'
      })
    },
    business_roles: function(project_id) {
      return request({
        url: base + '/project/' + project_id + '/business_roles',
        method: 'get'
      })
    },
    comments: function(data) {
      return request({
        url: base + '/project/' + data.project_id + '/comments/',
        method: 'get',
        params: data
      })
    },
    live_brief: function() {
      return request({
        url: base + '/project/live_brief',
        method: 'get'
      })
    },
    add: function(status, data) {
      return request({
        url: base + '/project/' + status,
        method: 'post',
        data: data
      })
    },
    addConsultant: function(data) {
      return request({
        url: base + '/project/consultant',
        method: 'post',
        data: data
      })
    },
    add_comment: function(data) {
      return request({
        url: base + '/project/' + data.project_id + '/comment/',
        method: 'post',
        data: data
      })
    },
    apply: function(id, data) {
      return request({
        url: base + '/project/' + id + '/apply',
        method: 'post',
        data: data
      })
    },
    back: function(id, data) {
      return request({
        url: base + '/project/' + id + '/back',
        method: 'post',
        data: data
      })
    },
    pass: function(id, data) {
      return request({
        url: base + '/project/' + id + '/pass',
        method: 'post',
        data: data
      })
    },
    no_pass: function(id, data) {
      return request({
        url: base + '/project/' + id + '/no_pass',
        method: 'post',
        data: data
      })
    },
    complete: function(id, data) {
      return request({
        url: base + '/project/' + id + '/complete',
        method: 'post',
        data: data
      })
    },
    restart: function(id, data) {
      return request({
        url: base + '/project/' + id + '/start',
        method: 'post',
        data: data
      })
    },
    stop: function(id, data) {
      return request({
        url: base + '/project/' + id + '/stop',
        method: 'post',
        data: data
      })
    },
    updateClientManager: function(data) {
      return request({
        url: base + '/project/client_manager',
        method: 'put',
        data: data
      })
    },
    updateManagerConsultant: function(data) {
      return request({
        url: base + '/project/manager_consultant',
        method: 'put',
        data: data
      })
    },
    update: function(data) {
      return request({
        url: base + '/project/' + data.id,
        method: 'put',
        data: data
      })
    }
  },
  cv: {
    all: function(data) {
      return request({
        url: base + '/cv/',
        method: 'get',
        params: data
      })
    },
    getCvBriefInfo: function(data) {
      return request({
        url: base + '/cv/brief',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/cv/' + id,
        method: 'get'
      })
    },
    getOpIshandle: function(id) {
      return request({
        url: base + '/cv/' + id + '/op',
        method: 'get'
      })
    },
    getOffer: function(id) {
      return request({
        url: base + '/cv/' + id + '/offer',
        method: 'get'
      })
    },
    update: function(data) {
      return request({
        url: base + '/cv/' + data.id,
        method: 'put',
        data: data
      })
    },
    send_client_manager: function(id) {
      return request({
        url: base + '/cv/' + id + '/send_client_manager',
        method: 'post'
      })
    },
    send_client: function(id) {
      return request({
        url: base + '/cv/' + id + '/send_client',
        method: 'post'
      })
    },
    interview: function(id, data) {
      return request({
        url: base + '/cv/' + id + '/interview',
        method: 'post',
        data: data
      })
    },
    interview_end: function(id, data) {
      return request({
        url: base + '/cv/' + id + '/interview_end',
        method: 'post',
        data: data
      })
    },
    signoffer: function(id, data) {
      return request({
        url: base + '/cv/' + id + '/offer',
        method: 'post',
        data: data
      })
    },
    onboading: function(id, data) {
      return request({
        url: base + '/cv/' + id + '/onboading',
        method: 'post',
        data: data
      })
    },
    over: function(id) {
      return request({
        url: base + '/cv/' + id + '/sent_over',
        method: 'post'
      })
    },
    out: function(id, data) {
      return request({
        url: base + '/cv/' + id + '/out',
        method: 'post',
        data: data
      })
    },
    feedback: function(id, data) {
      return request({
        url: base + '/cv/' + id + '/interview',
        method: 'put',
        data: data
      })
    }
  },
  candidate: {
    all: function(data) {
      return request({
        url: base + '/candidate/',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/candidate/' + id,
        method: 'get'
      })
    },
    getIndex: function(id) {
      return request({
        url: base + '/candidate/' + id + '/index',
        method: 'get'
      })
    },
    comments: function(data) {
      return request({
        url: base + '/candidate/' + data.candidate_id + '/comments/',
        method: 'get',
        params: data
      })
    },
    add: function(data) {
      return request({
        url: base + '/candidate/',
        method: 'post',
        data: data
      })
    },
    resume: function(data) {
      return request({
        url: base + '/candidate/resume',
        method: 'post',
        data: data
      })
    },
    upload_resume: function(data) {
      return request({
        url: base + '/uploadFiles',
        method: 'post',
        data: data
      })
    },
    add_comment: function(data) {
      return request({
        url: base + '/candidate/' + data.candidate_id + '/comment/',
        method: 'post',
        data: data
      })
    },
    cv: function(id, project_id) {
      return request({
        url: base + '/candidate/' + id + '/project/' + project_id,
        method: 'post'
      })
    },
    cvs: function(ids, project_id) {
      return request({
        url: base + '/candidate/candidate_ids/project/' + project_id,
        method: 'post',
        data: {
          candidate_ids: ids
        }
      })
    },
    update: function(data) {
      return request({
        url: base + '/candidate/' + data.id,
        method: 'put',
        data: data
      })
    },
    delete: function(id) {
      return request({
        url: base + '/candidate/' + id,
        method: 'delete'
      })
    }
  },
  list: {
    all: function(data) {
      return request({
        url: base + '/list/',
        method: 'get',
        params: data
      })
    },
    get: function(id) {
      return request({
        url: base + '/list/' + id,
        method: 'get',
        responseType: 'blob'
      })
    },
    add: function(data) {
      return request({
        url: base + '/list/',
        method: 'post',
        data: data
      })
    }
  }
}
